/*     */ package com.zimbra.cs.service.admin;
/*     */ 
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.soap.Element;
/*     */ import com.zimbra.common.util.Log;
/*     */ import com.zimbra.common.util.Pair;
/*     */ import com.zimbra.common.util.ZimbraLog;
/*     */ import com.zimbra.cs.account.NamedEntry;
/*     */ import com.zimbra.cs.account.Provisioning;
/*     */ import com.zimbra.cs.account.accesscontrol.GranteeType;
/*     */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*     */ import com.zimbra.soap.ZimbraSoapContext;
/*     */ import com.zimbra.soap.admin.type.GranteeSelector.GranteeBy;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public abstract class RightDocumentHandler
/*     */   extends AdminDocumentHandler
/*     */ {
/*     */   protected void checkCheckRightRight(ZimbraSoapContext zsc, GranteeType granteeType, GranteeSelector.GranteeBy granteeBy, String grantee)
/*     */     throws ServiceException
/*     */   {
/*  58 */     checkCheckRightRight(zsc, granteeType, granteeBy, grantee, false);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   protected boolean checkCheckRightRight(ZimbraSoapContext zsc, GranteeType granteeType, GranteeSelector.GranteeBy granteeBy, String grantee, boolean granteeCanBeExternalEmailAddr)
/*     */     throws ServiceException
/*     */   {
/*  78 */     NamedEntry granteeEntry = null;
/*     */     try
/*     */     {
/*  81 */       granteeEntry = GranteeType.lookupGrantee(Provisioning.getInstance(), granteeType, granteeBy, grantee);
/*     */     }
/*     */     catch (ServiceException e)
/*     */     {
/*  85 */       ZimbraLog.acl.debug("unable to find grantee", e);
/*     */     }
/*     */     
/*  88 */     if (granteeEntry != null)
/*     */     {
/*     */ 
/*     */ 
/*     */ 
/*  93 */       if (granteeType == GranteeType.GT_USER) {
/*  94 */         checkRight(zsc, granteeEntry, Rights.Admin.R_checkRightUsr);
/*  95 */       } else if (granteeType == GranteeType.GT_GROUP)
/*     */       {
/*     */ 
/*  98 */         checkRight(zsc, granteeEntry, Rights.Admin.R_checkRightGrp);
/*     */       } else {
/* 100 */         throw ServiceException.PERM_DENIED("invalid grantee type for check right:" + granteeType.getCode());
/*     */       }
/*     */       
/* 103 */       return true;
/*     */     }
/* 105 */     if (granteeCanBeExternalEmailAddr) {
/* 106 */       return false;
/*     */     }
/* 108 */     throw ServiceException.PERM_DENIED("unable to check checkRight right for " + grantee);
/*     */   }
/*     */   
/*     */   protected Pair<Boolean, Boolean> parseExpandAttrs(Element request)
/*     */     throws ServiceException
/*     */   {
/* 114 */     String expandAttrs = request.getAttribute("expandAllAttrs", null);
/* 115 */     boolean expandSetAttrs = false;
/* 116 */     boolean expandGetAttrs = false;
/* 117 */     if (expandAttrs != null) {
/* 118 */       String[] eas = expandAttrs.split(",");
/* 119 */       for (String e : eas) {
/* 120 */         String exp = e.trim();
/* 121 */         if (exp.equals("setAttrs")) {
/* 122 */           expandSetAttrs = true;
/* 123 */         } else if (exp.equals("getAttrs")) {
/* 124 */           expandGetAttrs = true;
/*     */         } else {
/* 126 */           throw ServiceException.INVALID_REQUEST("invalid expandAllAttrs value: " + exp, null);
/*     */         }
/*     */       }
/*     */     }
/* 130 */     return new Pair(Boolean.valueOf(expandSetAttrs), Boolean.valueOf(expandGetAttrs));
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/RightDocumentHandler.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */